1. /* sdfatant.cpp by K.Tsuru */
  2. // function ID = 3602 DARDIX
  3. /**************************************************
  4. SDouble class
  5. inverse trigonometric function arctan x
  6. using an addition theorem
  7. arctan(x) = arctan(y) + arctan{(x-y)/(1+x*y)}.
  8. For the algorithm see Asin().It is faster than AtanA(x)
  9. a little.The the conditions |x| << 1.0 and |x| >> 1.0
  10. are not checked.They are done in Atan().
  11. **************************************************/
  12. #ifndef SN_H
  13. #include "sn.h"
  14. #endif
  15. static void AtanTApproX(const SDouble& x, SDouble& approX){
  16. SDouble y;
  17. y = Tan(approX); // fastest function TanBS() is used version 2.21. See "snmath.h"
  18. y = (x - y)/(1.0 + x*y);
  19. approX += AtanSeries(y, approX.RdxExp());
  20. }
  21. SDouble AtanT(const SDouble& x){
  22. RealSize C;
  23. SDouble r;
  24. // Oct 19, 2000 Change here.
  25. // exclude "const" since 2.191 for the error of bcc55 E2015
  26. uint ef = x.EffFig(), fig = (ef >= 2048u) ? 125u : 25u;
  27. double dblX = doubleD(x);
  28. //An intermediate step is inserted.
  29. C.SetEffFig(min(fig, ef));
  30. r = atan(dblX);
  31. AtanTApproX(x, r);
  32. C.SetEffFig(0);
  33. if( x.EffFig() > fig ) AtanTApproX(x, r); //full precision
  34. return r;
  35. }

sdfatant.cpp : last modifiled at 2015/12/03 21:32:55(1,169 bytes)
created at 2017/10/07 10:22:50
The creation time of this html file is 2017/10/07 11:29:39 (Sat Oct 07 11:29:39 2017).